package com.heihx.api.client;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.heihx.api.client.fallback.MealClientFallback;
import com.heihx.api.config.DefaultFeignConfig;
import com.heihx.entity.Dish;
import com.heihx.entity.Orders;
import com.heihx.entity.Setmeal;
import com.heihx.result.Result;
import com.heihx.vo.DishVO;
import com.heihx.vo.SetmealVO;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Map;

@FeignClient(value = "meal-service",
configuration = DefaultFeignConfig.class,
fallbackFactory = MealClientFallback.class)
public interface MealClient {
    /**
     * 根据id查询菜品
     * @param id
     * @return
     */
    @GetMapping("/user/dish/{id}")
    Result<DishVO> getDishById(@PathVariable Long id);

    /**
     * 根据id查询套餐，用于修改页面回显数据
     * @param id
     * @return
     */
    @GetMapping("/user/setmeal/{id}")
    @Operation(summary = "根据id查询套餐")
    Result<SetmealVO> getSetMealById(@PathVariable Long id);

    /**
     * 统计菜品数量
     * @param status
     * @return
     */
    @GetMapping("/admin/dish/countByMap")
    @Operation(summary = "统计菜品")
    Result<Long> countDish(@RequestParam(value = "status") Integer status);

    /**
     * 统计套餐数量
     * @param status
     * @return
     */
    @GetMapping("/admin/setmeal/countByMap")
    @Operation(summary = "统计套餐")
    Result<Long> countSetMeal(@RequestParam(value = "status") Integer status);
}
